package com.example.friend.controller;

import com.example.api.domain.vo.UserQuestionResultVO;
import com.example.common.core.controller.BaseController;
import com.example.common.core.model.R;
import com.example.friend.model.user.dto.UserSubmitDTO;
import com.example.friend.service.IUserQuestionService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * 功能描述:
 *
 * @author Lenovo
 * @date 2025/4/8
 */
@RestController
@RequestMapping("/user/question")
public class UserQuestionController extends BaseController {

    @Resource
    private IUserQuestionService userQuestionService;
    @PostMapping("/submit")
    public R<UserQuestionResultVO> submit(@RequestBody UserSubmitDTO submitDTO) {
        return userQuestionService.submit(submitDTO);
    }

    @PostMapping("/rabbit/submit")
    public R<Void> rabbitSubmit(@RequestBody UserSubmitDTO submitDTO) {
        return toResult(userQuestionService.rabbitSubmit(submitDTO));
    }

    @GetMapping("/exe/result")
    public  R<UserQuestionResultVO> exeResult(Long examId, Long questionId, String currentTime) {
        return R.ok(userQuestionService.exeResult(examId, questionId, currentTime));
    }
}
